package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TInaccount;
import com.ruoyi.system.service.ITInaccountService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 换汇到账Controller
 * 
 * @author ruoyi
 * @date 2022-03-17
 */
@RestController
@RequestMapping("/system/inaccount")
public class TInaccountController extends BaseController
{
    @Autowired
    private ITInaccountService tInaccountService;

    /**
     * 查询换汇到账列表
     */

    @GetMapping("/list")
    public TableDataInfo list(TInaccount tInaccount)
    {
        startPage();
        List<TInaccount> list = tInaccountService.selectTInaccountList(tInaccount);
        return getDataTable(list);
    }

    /**
     * 导出换汇到账列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInaccount tInaccount)
    {
        List<TInaccount> list = tInaccountService.selectTInaccountList(tInaccount);
        ExcelUtil<TInaccount> util = new ExcelUtil<TInaccount>(TInaccount.class);
        util.exportExcel(response, list, "换汇到账数据");
    }

    /**
     * 获取换汇到账详细信息
     */
    @GetMapping(value = "/{iid}")
    public AjaxResult getInfo(@PathVariable("iid") Long iid)
    {
        return AjaxResult.success(tInaccountService.selectTInaccountByIid(iid));
    }

    /**
     * 新增换汇到账
     */
    @PostMapping
    public AjaxResult add(@RequestBody TInaccount tInaccount)
    {
        return toAjax(tInaccountService.insertTInaccount(tInaccount));
    }

    /**
     * 修改换汇到账
     */

    @PutMapping
    public AjaxResult edit(@RequestBody TInaccount tInaccount)
    {
        return toAjax(tInaccountService.updateTInaccount(tInaccount));
    }

    /**
     * 删除换汇到账
     */

	@DeleteMapping("/{iids}")
    public AjaxResult remove(@PathVariable Long[] iids)
    {
        return toAjax(tInaccountService.deleteTInaccountByIids(iids));
    }
}
